package com.ruoyi.system.service.impl;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysDept;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.domain.SysSku;
import com.ruoyi.system.domain.SysStock;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysSkuMapper;
import com.ruoyi.system.mapper.SysStockMapper;
import com.ruoyi.system.service.ISysSkuService;
import com.ruoyi.system.service.ISysStockService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * 库存管理 服务实现
 * 
 * @author ruoyi
 */
@Service
public class SysStockServiceImpl implements ISysStockService
{
    @Autowired
    private SysStockMapper stockMapper;

    /**
     * 查询库存管理数据
     *
     * @param stock 库存信息
     * @return 库存信息集合
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<SysStock> selectStockList(SysStock stock)
    {
        return stockMapper.selectStockList(stock);
    }

    /**
     * 新增保存库存信息
     * 
     * @param stock 库存信息
     * @return 结果
     */
    @Override
    public int insertStock(SysStock stock)
    {

        return stockMapper.insertSelective(stock);
    }
    @Override
    public SysStock selectStockById(Long stockId) {
        return stockMapper.selectByPrimaryKey(stockId);
    }

    @Override
    public int updateStock(SysStock stock) {
        return stockMapper.updateByPrimaryKeySelective( stock);
    }





}
